package com.ity.teamanagement;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

/**
 * @author Administrator
 */
@SpringBootApplication
public class TeaManagementApplication {

    private static String MAX_SINGE_FILE_SIZE = "15360KB";
    private static String MAX_ALL_FILE_SIZE = "102400KB";

    public static void main(String[] args) {
        SpringApplication.run(TeaManagementApplication.class, args);
    }

    /**
     * 文件上传配置
     * @return
     */

    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
       //文件最大
        factory.setMaxFileSize(DataSize.parse(MAX_SINGE_FILE_SIZE));
       // 设置总上传数据总大小
        factory.setMaxRequestSize(DataSize.parse(MAX_ALL_FILE_SIZE));
        return factory.createMultipartConfig();

    }



}

